package linwen.wang.swagger.controller;


import io.swagger.annotations.*;
import linwen.wang.common.resp.BaseResp;
import linwen.wang.swagger.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserController
 * @Description  访问地址：   http://localhost:8081/swagger/swagger-ui/index.html
 * @Author lin
 * @Date 2022/3/29 下午9:57
 * @Version V1.0
 */
@RestController
@Api(tags="用户管理")
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation(value = "根据id查找用户")
    @ApiModelProperty(example = "1",required = true)
    @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = BaseResp.class) })
    @GetMapping("/{id}")
    public BaseResp getUserById(@ApiParam("用户的id")@PathVariable String id){
        return userService.getUserById(id);
    }
}
